import request from '@/utils/request'

export function searchmain(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/searchMain/v1',
    method: 'post',
    data
  })
}

export function addmain(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/saveMain/v1',
    method: 'post',
    data
  })
}

export function changemain(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/saveMain/v1',
    method: 'post',
    data
  })
}
export function deletemain(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/softDeleteMainById/v1',
    method: 'post',
    data: data
  })
}

export function getbasictype(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/getSubByPid/v1/1',
    method: 'get',
    data
  })
}

export function getLevelTwoType(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/searchSubByPage/v1',
    method: 'post',
    data
  })
}

// 根据字典类型查询字典数据信息
export function getDicts(pcode) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/searchSubByPage/v1',
    method: 'post',
    data: {'searchParams': {pcode: pcode}}
  })
}

export function changeLevelTwoType(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/updateSub/v1',
    method: 'post',
    data
  })
}

export function deleteLevelTwoType(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/softDeleteSubById/v1',
    method: 'post',
    data
  })
}

export function addLevelTwoType(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/saveSub/v1',
    method: 'post',
    data
  })
}

export function getLevelThreeType(data) {
  return request({
    url: '/api/xd/pro/dict/dicttype/DicttypeRest/searchSubByPage/v1',
    method: 'post',
    data
  })
}
